//
//  WatchLocationModel.m
//  Kids
//
//  Created by LiTengFei on 14/11/29.
//  Copyright (c) 2014年 90's Technology Co.Ltd. All rights reserved.
//

#import "WatchLocationModel.h"

@implementation WatchLocationModel
- (void)setGPS:(NSString*)GPS
{
    NSParameterAssert(GPS);
    _GPS = GPS;
    NSArray* array = [GPS componentsSeparatedByString:@","];
    if(array.count==1){
        return;
    }
    NSParameterAssert(array.count == 4);
    NSString* latitude1 = [array[0] substringToIndex:2];
    NSString* latitude2 = [array[0] substringFromIndex:2];

    NSString* longitude1 = [array[2] substringToIndex:3];
    NSString* longitude2 = [array[2] substringFromIndex:3];
    /*!
     X=30+(18.2806/60)+0.0143
     刘放  19:43:15
     Y=120+(04.7542/60)-0.014
     学姐  19:44:14
     */
    double latitude = [latitude1 doubleValue] + ([latitude2 doubleValue] / 60);
    double longitude = [longitude1 doubleValue] + ([longitude2 doubleValue] / 60);

    self.coordinate = CLLocationCoordinate2DMake(latitude, longitude);
}
@end
